home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-03-19 | 77.9 KB | 2,314 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: Adobe Photoshop PPC 3.0.1.vu
- #
- # Contains: Quick look test script for Photoshop version PPC 3.0.1
- #
- # Written by: Mitch Forcnrook
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # 2.0 03/07/96 MDF Added functional script parts and
- # beefed up QL tests.
- # 1.3 02/15/96 G O'Sullivan Upgraded to use b-trait
- # 1.2.2 02/14/96 Mary Lehane Updated so that it would dismiss the floating
- # window during the setting up of the globals
- # 1.2.1 12/13/95 M. Forncrook Fixed name in resource for gAppTitle.
- # 1.2 09/01/95 G O'Sullivan Made script localizable.
- # 1.1 08/23/95 G O'Sullivan/MDF Added Printer Testing. Modified
- # the HandleDialogs() task.
- # 1.0 01/04/95 M. Forncrook Updated from version 2.5.1 to version 3.0.1 for PowerPC.
- #
- # ****************************************************************************
- #
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Output.Lib","DoTasks.Lib","Draw.Lib","UserInterface.Lib","DA.Lib",
- "Geometry.Lib","Font.Lib","Globals.Lib","LaunchQuit.Lib","TCS.Lib",
- "TargetCheck.Lib","ExceptionHandling.Lib","WorldReady.lib",
- "String.Lib","StandardFile.Lib","Clouseau.Lib","TestLevel.Lib";
-
-
- #########################################################################
- ######## Application Specific Tasks
- #########################################################################
-
- #########################################################################
- # InitAppGlobals()
- #========================================================================
- # Author: ML
- # Description: Sets up tools for Photoshop. This task
- # must be called first.
- # Parameters: None
- # Returns: Nothing
- # Examples: InitAppGlobals()
- #========================================================================
- # History:
- # 08/23/95 GOS Added gDoCloseAppHook2
- #
- ########################################################################
- task InitAppGlobals()
- begin
- logstr("Setting up {global gApptitle}'s globals");
-
- ### For Intl support
- global gScriptResourceBase;
-
- ### Region Insets
- global gWindowInset := {10,10,25,25};
- global gScreenInset := {62,25,10,10};
-
- ### Custom Opening 'New' dialog for DoSetupApp()
- global gCustomNewDocDialog := [window t:'New' o:1];
-
- ### Overide default window desc used in OpenFile()
- global gCustomRetrievedDoc := [window t:/≈RGB≈/]; # partial name of the saved document
-
- ### Tool Types
- global kClick, kDrag, kDragClick, kMultiDrag, kMultiClickDrag, kMultiClick;
-
- ### Palette Types
- global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
-
- ### Palette Numbers
- global kToolPaletteNum := 1;
- global kScreenModeToolPaletteNum := 2;
- global kLinePaletteNum := 3;
- global kColorPaletteNum := 4; # actually defined in SetPhotoshopColor()
- global kBackgroundColorPaletteNum := 4; # same as the color palette, defined in SetPhotoshopBackgroundColor()
-
- ### Palette Structures
- global gPaletteList :=
- {
- { #### Start Palette #1 - Main Tools
- {GetIndString(gScriptResourceBase+4,12),2,1}, # Specifier, Top margin, Left margin
- kPalWind, # Palette type
- {2,10}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {26,21} # Offset between tools {h,v}
- }, #### End Palette #1 - Main Tools
- { #### Start Palette #2 - Screen Mode Tools
- {GetIndString(gScriptResourceBase+4,12),296,4}, # Specifier, Top margin, left margin
- kPalWind, # Palette type
- {3,2}, # Size {numElemsWide,numElemsTall}, bug in SPEC with 1xn palettes
- {15,15} # Offset between tools {h,v}
- }, #### End Palette #2 - Screen Mode Tools
- { #### Start Palette #3 - Brushes
- {GetIndString(gScriptResourceBase+4,15),16,0}, # Specifier, Top margin, left margin
- kPalWind, # Palette type
- {6,2}, # Size {numElemsWide,numElemsTall}
- {32,32} # Offset between tools {h,v}
- } #### End Palette #3 - Brushes
- };
-
-
- ### PhotoShop {flag,pat,lnWght,Col,grad,bgCol,TxtCol,penPat}
- ### Palette Elements:= Tool#, Pal#, ToolName, ToolType, DblClktoEnd SetAttributes
- global MarqueeTool := { 1, 1, "Marquee", kDrag, 0, {0} };
- global LassoTool := { 2, 1, "Lasso", kMultiDrag, 0, {0} };
- global MagicWandTool := { 3, 1, "MagicWand", kClick, 0, {0} };
- global MoveTool := { 4, 1, "Move", kDrag, 0, {0} };
- global HandTool := { 5, 1, "Hand", kMultiDrag, 0, {0} };
- global ZoomTool := { 6, 1, "Zoom", kClick, 0, {0} };
- global CropTool := { 7, 1, "Crop", kDrag, 1, {0} };
- global TypeTool := { 8, 1, "Type", kClick, 0, {1,0,0,0,0,0,0,0} };
- global PaintBucketTool := { 9, 1, "PaintBucket", kClick, 0, {1,0,0,1,0,0,0,0} };
- global GradientFillTool := { 10, 1, "GradientFill", kDrag, 0, {1,0,0,1,0,1,0,0} };
- global LineTool := { 11, 1, "Line", kDrag, 0, {1,0,0,1,0,0,0,0} };
- global EyeDropperTool := { 12, 1, "EyeDropper", kMultiClick, 0, {0} };
- global EraserTool := { 13, 1, "Eraser", kMultiDrag, 0, {1,0,0,0,0,1,0,0} };
- global PencilTool := { 14, 1, "Pencil", kMultiDrag, 0, {1,0,1,1,0,0,0,0} };
- global AirbrushTool := { 15, 1, "Airbrush", kMultiDrag, 0, {1,0,1,1,0,0,0,0} };
- global PaintBrushTool := { 16, 1, "PaintBrush", kMultiDrag, 0, {1,0,1,1,0,0,0,0} };
- global RubberStampTool := { 17, 1, "RubberStamp", kDragClick, 0, {1,0,1,0,0,0,0,0} };
- global SmudgeTool := { 18, 1, "Smudge", kMultiDrag, 0, {1,0,1,0,0,0,0,0} };
- global BlurTool := { 19, 1, "Blur", kMultiDrag, 0, {1,0,1,0,0,0,0,0} };
- global DodgeTool := { 20, 1, "Dodge", kMultiDrag, 0, {1,0,1,0,0,0,0,0} };
- global StndWindowsTool := { 1, 2, "StandardWindows", 0, 0, {0} };
- global FullScrnMBarTool := { 2, 2, "FullScreenWithMenuBar",0, 0, {0} };
- global FullScrnNoMBarTool :={ 3, 2, "FullScreenNoMenuBar", 0, 0, {0} };
-
- ### List of Tools to use by DoDraw()
- global gToolList := {
- MarqueeTool,
- LassoTool,
- HandTool,
- ZoomTool,
- MoveTool,
- HandTool,
- ZoomTool,
- CropTool,
- PaintBucketTool,
- GradientFillTool,
- LineTool,
- EyeDropperTool,
- EraserTool,
- PencilTool,
- AirbrushTool,
- PaintBrushTool,
- SmudgeTool,
- BlurTool,
- DodgeTool
- };
-
-
- ### Font characteristic lists
- #global gFontList := {'Chicago','Courier','Geneva','Helvetica','Monaco','New York','Palatino',Symbol','Times'};
- global gFontList := BuildListFromResourcePhotoShop(gScriptResourceBase+1);
- #global gFontSizeList := {'4','9','10','12','14','18','24','48'};
- global gFontSizeList := BuildListFromResourcePhotoShop(gScriptResourceBase+2);
- #global gFontStyleList := {'Bold','Italic','Underline','Outline','Shadow','Anti-Aliased'};
- global gFontStyleList := BuildListFromResourcePhotoShop(gScriptResourceBase+3);
-
- ### Name of the Plain (style) menu item ####
- global gPlainStyle := ''; # there is no Plain style
-
- ### How to get to the next line
- global gNextLineMethod := 1;
- ### 1 - ReturnKey, 2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
-
- ### Does moving to the next line clear all font info
- global gNextLineClearsFontSettings := 1;
- ### 0 - font settings cleared on next line, 1 - font settings not cleared on next line
-
- ### Set Window tests
- global gDoWindowList:= {1,0,0,1};
- # Set each element to 1 or 0. Flag for performing DoWindows tests as follows:
- # Element: 1 - Sizing
- # 2 - Scrolling
- # 3 - Dragging
- # 4 - Zooming
-
-
- ############# Define Application Specific Hooks #############
- global gDoSetUpAppHook1 := task HandleDialogsHook;
- global gCustomScrapText := task CustomScrapText;
- global gCustomScrapPict := task CustomScrapPict;
- global gSetupDoText := task SetupTextTests;
- global gSetFont := task SetPhotoshopFont;
- global gSetSize := task SetPhotoshopSize;
- global gSetStyle := task SetPhotoshopStyle;
- global gDoTextTypeStrHook1 := task PhotoshopPreTypeStr;
- global gReportSelectedMenuItems := task ReportPhotoshopFontItems;
- global gNextLine := task SetupTextTests;
- global gSetLine := task SetPhotoshopLine;
- global gSetColor := task SetPhotoshopColor;
- global gSetBackgroundColor := task SetPhotoshopBackgroundColor;
- global gModifyDocument := task ModifyForRevertHook;
- global gDoCloseAppHook2 := task PrintForCloseHook;
-
- end; # InitAppGlobals
-
-
- #########################################################################
- # BuildListFromResourcePhotoShop( idNum )
- #========================================================================
- # Author: KTA
- # Description: Returns a list generated from all of the strings in a specified
- # string list resource specified by <idNum>.
- # Parameters: idNum := resource id number for the string list resource.
- # Returns: list - all strings in specified string list resource.
- # Examples: BuildListFromResourcePhotoShop( 1000 );
- # Assumptions: This task must be contained within the same file that contains
- # the resources. Currently this task only supports up to 100 strings
- # in a single str# resource.
- # Note: A duplicate of this task exists in 'Globals.Lib'. The reason
- # for this is that Vu has a limitation in the way it handles
- # resources in that it requires that a full path to the file be
- # provided or the resources exist in the current file. Since we
- # do not have access to a fullpath, and do not want to require
- # all users to name their hard drives and folders the same, we
- # opted to place a duplicate copy of this task in all files that
- # want to use it. The naming convesion is to append the name
- # of the application under test to the end of the task name.
- # For example, BuildListFromResourceMacDraw()
- #========================================================================
- # History: 10/09/95 Sarath A Modified for FileMaker Pro 2.1v3
- #
- #########################################################################
- task BuildListFromResourcePhotoShop(idNum)
- begin
- numtimes := 100; #Assumes no resource will contain more than 100 strings
- theList := {};
- for i := 1 to numtimes
- begin
- CurrentFont := GetIndString(idNum,i);
- #Println "This is the currentFont - ", currentFont;
- if (isUndefined(CurrentFont))
- numtimes := i;
- else
- theList := Insert(CurrentFont,Card(theList)+1, theList);
- end;
- #println "This is theList - ", theList;
- return(theList);
- end; # BuildListFromResourcePhotoShop
-
-
- #########################################################################
- # HandleDialogsHook()
- #========================================================================
- # Author: Mona Chow
- # Description: Hide Brushes, Picker and Layers Palette if any of them is
- # shown currently. Then creates a new document. First if
- # statement below checks for low memory dialog.
- # Parameters: None
- # Returns: Nothing
- # Examples: HandleDialogsHook();
- # Assumptions: None
- #========================================================================
- # History:
- # GO'S 02/15/96 Updated MoveRelativeToWindow() coordinates to be window bound.
- # ML 02/14/96 Corrected resource problems and localised some statements.
- # MDF 08/24/95 Replaced match statements with await_presence.
- #########################################################################
- task HandleDialogsHook()
- begin
- ### MDF: Added to check for low memory dialog.
- if( await_presence([window o:1 k:{[button t:GetIndString(global gScriptResourceBase+4,13)],
- [button t:GetIndString(global gScriptResourceBase+4,14)]}],30) ) # "Continue", "Quit"
- SelectButton(GetIndString(global gScriptResourceBase+4,13)); # "Continue"
-
- if ( await_presence([staticText t:GetIndString(global gScriptResourceBase+4,2) w:1],20) ) # Static text is: "Please locate the plug-ins folder:"
- DialogDismisser(GetIndString(global gScriptResourceBase+4,3)); # Select 'None' button
-
-
- if( _matchBoolean([menuitem t:GetIndString(global gScriptResourceBase+4,4)]) ) # 'Hide Brushes'
- SelectMenuItem(GetIndString(global gScriptResourceBase+4,4), GetIndString(global gScriptResourceBase+4,7), GetIndString(global gScriptResourceBase+4,8));
- # 'Hide Brushes','Palettes','Window'
-
- if( _matchBoolean([menuitem t:GetIndString(global gScriptResourceBase+4,5)]) ) # 'Hide Picker'
- SelectMenuItem(GetIndString(global gScriptResourceBase+4,5), GetIndString(global gScriptResourceBase+4,7), GetIndString(global gScriptResourceBase+4,8));
- # 'Hide Picker','Palettes','Window'
-
- if( _matchBoolean([menuitem t:GetIndString(global gScriptResourceBase+4,6)]) ) # 'Hide Layers'
- SelectMenuItem(GetIndString(global gScriptResourceBase+4,6), GetIndString(global gScriptResourceBase+4,7), GetIndString(global gScriptResourceBase+4,8));
- # 'Hide Layers','Palettes','Window'
-
- LogStr('Brushes, Picker and Layers palette are now hidden.');
-
- end; # HandleDialogsHook
-
-
- #########################################################################
- # CustomScrapText()
- #========================================================================
- # Author: MDF
- # Description: Performs the scrapbook test for text. Needed because in order
- # to do this test, text tool has to be clicked in the document
- # and the text is pasted into a dialog which is then cleared.
- # Parameters: None
- # Returns: Nothing
- # Examples: CustomScrapText();
- # Assumptions: None
- #========================================================================
- # History:
- # 03/07/96 MDF Created.
- #########################################################################
- task CustomScrapText()
- begin
- global gScriptResourceBase, gPrevAppTitle, gIntegration, kScrapTEXT,
- kScrapPICT, gAppTitle, gScrapTitle;
-
- temp := gIntegration;
- Integration := 0; #To turn off global Integration - KTA
- tempgBackgroundQuit:= global gBackgroundQuit;
- gBackgroundQuit:= 0;
- tempgForceQuit:= global gForceQuit;
- gForceQuit:= 0;
- tempgFillMemory:= global gFillMemory;
- gFillMemory:= 0;
- LogStr( "==========================================================");
- LogStr("Performing Scrapbook DA test.");
- returnval:=0;
- failStr := '';
- ScrapDescriptor := '';
- ccpFlag := 1; # default as set in Scrapbook()
- pasteFlag := 1; # default as set in Scrapbook()
- requestElement := kScrapTEXT;
- TCSNUM := 2;
-
- TCSStart({ TCSNUM, global kTCSetScrapBook }, 'ScrapBook');
-
- if not(gAppTitle)
- MatchApplication(0);
- if(LaunchTwitch(gScrapTitle,,,0))
- begin
- LogStr("Opened the Scrapbook");
- scBook := _match ([window t:gScrapTitle o:1]!,1);
- if(scBook.k[1].t = 'Play Sound') #put in fix for 7.0ß4 where sound button is control [1]
- SkrollBar := scBook.k[2];
- else
- SkrollBar := scBook.k[1];
- status := SkrollBar.s;
- if (status <> { 0, -1 })
- begin # if scrollbar is enabled...
- error := 0; # no errors yet
- elementCount := status[2] + 1; # elementCount = number of scrapbook elements
- currentElement := status[1] + 1; # currentElement = current position in Scrapbook
- newCount := elementCount + 1;
- if (requestElement>elementCount) begin # if position is greater than total elements in Scrapbook..
- if (ccpFlag = 1)
- LogStr("!@#$% Scrapbook entry {requestElement} does not exist! - Copying entry {currentElement} of {elementCount}");
- else if (ccpFlag = 3)
- LogStr("!@#$% Scrapbook entry {requestElement} does not exist! - Pasting to entry {currentElement} of {newCount}");
- else begin
- LogStr("!@#$% Can∂'t Cut/Clear - Scrapbook entry {requestElement} does not exist! Closing Scrapbook!");
- error := 1; # don't clear or cut if requested item not there
- end;
- end;
- else begin# we've got a valid Scrapbook entry
- _scroll (SkrollBar, 'a', {requestElement,elementCount});
- try match [scrollbar s:?status]!;
- catch theError
- ExceptionDispatcher(theError);
- currentElement := status[1] + 1; # currentElement = current position in Scrapbook
- LogStr("Scrolled to item {currentElement} of {elementCount} of the ScrapBook");
- wait(1);
- end;
-
- if (not error) begin
- if (ccpFlag = 1) begin # Copy Item
- if not( SelectMenuItem(4, 3)) # error - couldn't copy
- error := 1; # prepare to abort
- end;
- else if (ccpFlag = 2) begin
- if (not SelectMenuItem(3, 3)) # error - couldn't cut
- error := 1; # prepare to abort
- end;
- else if (ccpFlag = 3) begin
- if (not SelectMenuItem(5, 3)) # error - couldn't cut
- error := 1; # prepare to abort
- else
- LogStr("Pasted to entry {currentElement} of {newCount}");
- end;
- else if (ccpFlag = 4) begin
- if (not SelectMenuItem(6, 3)) # error - couldn't clear
- error := 1; # prepare to abort
- end;
- end;
- wait(2);
- tempTargetInfo := global gAdditionalTargetInfo;
- global gAdditionalTargetInfo := 0;
- LaunchTwitch(gPrevAppTitle,,0); # Twitch to it but don't launch it
- global gAdditionalTargetInfo := tempTargetInfo;
-
- if not (error)
- begin
- if (pasteFlag)
- begin # if we're supposed to paste back into document, do it
- wait(3);
- Draw(global TypeTool,,,,,[window t:/≈RGB≈/]); # partial title of window before it's been saved
- if( await_presence([window t:'Type Tool' o:1],60) )
- begin
- keyEq('v');
- LogStr("==========================================================");
- SpecialKey(EnterKey,"Enter Key - Clears 'Type Tool' dialog");
- if( await_absence([window t:'Type Tool' o:1],60) )
- returnVal := CurrentElement;
- else
- begin
- returnVal := 0;
- failStr := "Could not dismiss 'Type Tool' dialog by hitting return";
- logStr(failStr);
- DialogDismisser();
- end;
- end;
- else
- begin
- returnVal := 0;
- failStr := "'Type Tool' dialog failed to appear, could not paste text";
- logStr(failStr);
- end;
- end;
- end;
- end; # if scrollbar is enabled...
- else begin
- failStr := '!@#$% The horizontal scroll bar was not enabled to scroll';
- LogStr(failStr);
- closeWindow();
- end;
- end; # If(LaunchTwitch('Scrapbook'))
- else
- begin
- scrapReturn := -1; # couldn't launch is an expected failure
- LaunchTwitch(gPrevAppTitle,,0); # Twitch to it but don't launch it
- failStr := "Couldn't launch the Scrapbook";
- end;
-
- if (returnVal) # Return pass or fail
- begin
- ScrapReturn := 1;
- ScrapDescriptor := returnVal;
- end;
- else
- begin
- if not(scrapReturn = -1) # Couldn't launch
- ScrapReturn := 0;
- end;
-
- SetTool(global MarqueeTool);
- logStr("Click in the document window to disable text selection...");
- MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2); # deselects text
-
- TCSEnd({ TCSNUM, global kTCSetScrapBook }, ScrapReturn,failStr,,ScrapDescriptor); # End TCS
- gBackgroundQuit:= tempgBackgroundQuit;
- gForceQuit:= tempgForceQuit;
- gFillMemory:= tempgFillMemory;
- gIntegration := temp; #To reset the integration global - KTA
-
- return(returnval);
- end; # CustomScrapText
-
-
- #########################################################################
- # CustomScrapPict()
- #========================================================================
- # Author: MDF
- # Description: Performs the scrapbook test for Pict. This is needed because
- # the marquee around the pasted object in the document window
- # has to be deselected.
- # Parameters: None
- # Returns: Nothing
- # Examples: CustomScrapPict();
- # Assumptions: None
- #========================================================================
- # History:
- # 03/07/96 MDF Created.
- #########################################################################
- task CustomScrapPict()
- begin
- Scrapbook(global kscrapPict);
- SetTool(global MarqueeTool);
- logStr("Click in the document window to disable text selection...");
- MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2); # deselects text
- end; # CustomScrapPict
-
-
- #########################################################################
- # SetupTextTests(pTestMethod, pNumTimes)
- #========================================================================
- # Author: MDF
- # Description: Selects the TypeTool for and clicks in a random location in the
- # document window. Style settings are also cleared here for calls
- # to gNextLine
- # Parameters: pTestMethod - the method of testing desired.
- # 1 - Random font test
- # 2 - QuickLook font test
- # 3 - WaterFall font test
- # pNumTimes - (integer) number of times to perform the <pTestMethod>.
- # (not valid for WaterFall testing)
- # Returns: Nothing
- # Examples: SetupTextTests();
- # Assumptions: None
- #========================================================================
- # History:
- # 03/08/96 MDF Created.
- #########################################################################
- task SetupTextTests(pTestMethod := -1, pNumTimes := 1)
- begin
- global gScriptResourceBase, gFontStyleList;
-
- SetTool(global TypeTool);
- MoveRelativeToWindow(,,[window t:/≈RGB≈/],2); # clicks in document window (random)
-
- if( await_presence([window t:'Type Tool' o:1],120) )
- begin
- windBRect := (_match([window t:'Type Tool' o:1])).b;
-
- for each style in gFontStyleList
- begin
- _move('a',{0,0}); # move cursor out of search area
- logStr("Checking to see if styles need to be deselected...");
- switch style
- begin
- case GetIndString(gScriptResourceBase+3,1): # 'Bold'
- styleRect := {28,138,47,155}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,2): # 'Italic'
- styleRect := {28,158,47,172}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,3): # 'Underline'
- styleRect := {28,175,47,191}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,4): # 'Outline'
- styleRect := {140,138,156,155}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,5): # 'Shadow'
- styleRect := {140,158,156,172}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,6): # 'Anti-Aliased'
- styleRect := {140,175,156,191}; # rel to content rgn
- end;
-
- styleSearchRect := {windBRect[1]+styleRect[1],windBRect[2]+styleRect[2],
- windBRect[1]+styleRect[3],windBRect[2]+styleRect[4]};
- # styleRect converted from local coords
- # to screen coords
-
- _match([screen]); # do this BEFORE calling locateImage()
- styleChkboxRect := locateImage(,styleSearchRect,201);
- if(styleChkboxRect)
- begin
- clickPoint := CenterPointOfRect(styleChkboxRect);
- logStr("Deselecting the '{style}' checkbox by coordinates...");
- MoveMouse(clickPoint[1],clickPoint[2],,2);
- end;
- end;
- logStr("Finished checking style checkboxes.");
- SpecialKey(DeleteKey,"Delete Key - clear the text in the text entry box");
- SpecialKey(EnterKey,"Enter Key - close the 'Type Tool' dialog");
- end;
- end; # SetupTextTests
-
-
- #########################################################################
- # SetPhotoshopFont(pMyFont, pObjectNumber)
- #========================================================================
- # Author: MDF
- # Description: Selects pMyFont from the Font popup in the 'Type Tool' dialog.
- # Parameters: pMyFont - Name of the font.
- # pObjectNumber - Integer used to track all elements that make up
- # an Font record - TCS related.
- # Returns: returns what SelectMenuItem returns
- # 0 - failure
- # String - success
- # Examples: SetPhotoshopFont('Geneva');
- # Assumptions: That InitFonts() has been called thus global gCurrFontMenu
- # is set to the name of the menus which contain <pMyFont>. Also
- # requires the 'Type Tool' dialog to be present.
- #========================================================================
- # History:
- # 03/08/96 MDF Created.
- #########################################################################
- task SetPhotoshopFont(pMyFont := '', pObjectNumber := 'NA')
- begin
- global gScriptResourceBase;
-
- failStr := "";
- myReturn := 0;
-
- # coords rel to upper left corner of content region
- fontPopupClickPoint := {161,22}; # this point causes the font popup to display it's contents
- popUpDisplayRect := {78,-67,181,159}; # rect to search for font names in the font popup
-
- TCSStart({ 1, global kTCSetFont},"SetFont"); # Start TCS
-
- Draw(global TypeTool);
- if( await_presence([window t:'Type Tool' o:1],60) )
- begin
- windBRect := (_match([window t:'Type Tool' o:1])).b;
- searchRect := {windBRect[1]+popUpDisplayRect[1],
- windBRect[2]+popUpDisplayRect[2],
- windBRect[1]+popUpDisplayRect[3],
- windBRect[2]+popUpDisplayRect[4]};
- _match([screen]); # do this BEFORE calling locateString()
- MoveRelativeToWindow(fontPopupClickPoint[1],fontPopupClickPoint[2],
- [window t:'Type Tool' o:1]); # move over popup
- MoveMouse(windBRect[1]+161,0,[window t:'Type Tool' o:1],3);
- position := locateString(pMyFont,searchRect,
- GetIndString(gScriptResourceBase+1,1),12);
- if(position) # found it
- begin
- logStr("Selecting '{pMyFont}' in the font popup...");
- MoveMouse(position[1],position[2],,4);
- myReturn := 1;
- end;
- else
- begin # could not find font
- myReturn := 0;
- failStr := "Couldn't locate '{pMyFont}' in the font popup";
- logStr(failStr);
- _ReleaseMouse();
- end;
- end;
- else
- begin
- myReturn := 0;
- failStr := "The 'Type Tool' dialog was not present, could not select fonts";
- logStr(failStr);
- end;
-
- TCSEnd({ 1, global kTCSetFont},myReturn,failStr,pObjectNumber,pMyFont);
- return(myReturn);
-
- end; # SetPhotoshopFont
-
-
- #########################################################################
- # SetPhotoshopSize(pMySize, pObjectNumber)
- #========================================================================
- # Author: MDF
- # Description: Sets the currently selected font size to <pMySize> in the size
- # text entry box of the 'Type Tool' dialog.
- # Parameters: pMySize - Name of the size.
- # pObjectNumber - Integer used to track all elements that make up
- # an Font record - TCS related.
- # Returns: returns what SelectMenuItem returns
- # 0 - failure
- # String - success
- # Examples: SetPhotoshopSize('10');
- # Assumptions: That InitFonts() has been called thus global gCurrSizeMenu
- # is set to the name of the menus which contain <pMySize>. Also
- # requires the 'Type Tool' dialog to be present.
- #========================================================================
- # History:
- # 03/08/96 MDF Created.
- #########################################################################
- task SetPhotoshopSize(pMySize := '', pObjectNumber := 'NA')
- begin
- global gScriptResourceBase;
-
- failStr := '';
- myReturn := 0;
-
- sizeBoxLoc := {121,43}; # point to click in the size box
-
- TCSStart({ 2, global kTCSetFont },"SetSize"); # Start TCS
-
- if( await_presence([window t:'Type Tool' o:1],60) )
- begin
- logStr("Hiliting the size text entry box...");
- MoveRelativeToWindow(sizeBoxLoc[1],sizeBoxLoc[2],
- [window t:'Type Tool' o:1]); # to size box
- MoveMouse(-49,0,0,1); # move to the left with mousedown, hilites size box
- TypeStr(pMySize);
- myReturn := 1;
- end;
- else
- begin
- myReturn := 0;
- failStr := "The 'Type Tool' dialog was not present, could not select sizes";
- logStr(failStr);
- end;
-
- TCSEnd({ 2, global kTCSetFont },myReturn,failStr,pObjectNumber,pMySize);
- return(myReturn);
-
- end; # SetPhotoshopSize
-
-
- #########################################################################
- # SetPhotoshopStyle(pMyStyle, pObjectNumber)
- #========================================================================
- # Author: MDF
- # Description: Sets the currently selected font style to <pMyStyle> in the
- # 'Type Tool' dialog.
- # Parameters: pMyStyle - Name of the Style.
- # pObjectNumber - Integer used to track all elements that make up
- # an Font record - TCS related.
- # Returns: returns what SelectMenuItem returns
- # 0 - failure
- # String - success
- # Examples: SetPhotoshopStyle('Bold');
- # Assumptions: That InitFonts() has been called thus global gCurrStyleMenu
- # is set to the name of the menus which contain <pMyStyle>. Also
- # requires the 'Type Tool' dialog to be present.
- #========================================================================
- # History:
- # 03/08/96 MDF Created.
- #########################################################################
- task SetPhotoshopStyle(pMyStyle := '', pObjectNumber := 'NA')
- begin
- global gScriptResourceBase;
-
- failStr := "";
- myReturn := 0;
-
- TCSStart({ 1, global kTCSetFont},"SetFont"); # Start TCS
-
- if( await_presence([window t:'Type Tool' o:1],60) )
- begin
- windBRect := (_match([window t:'Type Tool' o:1])).b;
- _move('a',{0,0}); # move cursor out of search area
- switch pMyStyle
- begin
- case GetIndString(gScriptResourceBase+3,1): # 'Bold'
- styleRect := {28,138,47,155}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,2): # 'Italic'
- styleRect := {28,156,47,172}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,3): # 'Underline'
- styleRect := {28,175,47,191}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,4): # 'Outline'
- styleRect := {140,138,156,155}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,5): # 'Shadow'
- styleRect := {140,158,156,172}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,6): # 'Anti-Aliased'
- styleRect := {140,175,156,191}; # rel to content rgn
- end;
-
- styleSearchRect := {windBRect[1]+styleRect[1],windBRect[2]+styleRect[2],
- windBRect[1]+styleRect[3],windBRect[2]+styleRect[4]};
- # styleRect converted from local coords
- # to screen coords
-
- _match([screen]); # do this BEFORE calling locateImage()
- imageRect := locateImage(,styleSearchRect,200);
- if(imageRect)
- begin
- clickPoint := CenterPointOfRect(imageRect);
- logStr("Selecting '{pMyStyle}' checkbox by coordinates...");
- MoveMouse(clickPoint[1],clickPoint[2],,2);
- myReturn := 1;
- end;
- else
- begin
- myReturn := 0;
- failStr := "Could not locate '{pMyStyle}' style checkbox in the 'Type Tool' dialog";
- logStr(failStr);
- end;
- end;
- else
- begin
- myReturn := 0;
- failStr := "The 'Type Tool' dialog was not present, could not select styles";
- logStr(failStr);
- end;
-
- TCSEnd({ 1, global kTCSetFont},myReturn,failStr,pObjectNumber,pMyStyle);
- return(myReturn);
-
- end; # SetPhotoshopStyle
-
-
- #########################################################################
- # PhotoshopPreTypeStr(pTestMethod, pNumTimes)
- #========================================================================
- # Author: MDF
- # Description: Called just before entering gTextStr in DoText(). This task
- # will tab to the text entry box in the 'Type Tool' dialog.
- # Parameters: pTestMethod - the method of testing desired.
- # 1 - Random font test
- # 2 - QuickLook font test
- # 3 - WaterFall font test
- # pNumTimes - (integer) number of times to perform the <pTestMethod>.
- # (not valid for WaterFall testing)
- # Returns: nada
- # Examples: ReportPhotoshopFontItems({{'Format','Font'},{'Format','Styles'});
- # Assumptions:
- #========================================================================
- # History:
- # 03/08/96 MDF Created.
- #########################################################################
- task PhotoshopPreTypeStr(pTestMethod, pNumTimes)
- begin
- logStr("Tabbing to the text entry field...");
- SpecialKey(TabKey,"Tab Key",3);
- end; # PhotoshopPreTypeStr
-
-
- #########################################################################
- # ReportPhotoshopFontItems(pMenuList, pObjectNumber)
- #========================================================================
- # Author: MDF
- # Description: Collects all the menu items with a markChar ('') from the
- # defined menus defined in pMenuList. Then types each marked item
- # and calls NextLine() to move to the next text entry line.
- # Parameters: pMenuList - List of lists/strings
- # List of menus containing marked menuitems.
- # pObjectNumber - Integer - used to track all elements that make up
- # an Font record - TCS related.
- # Returns: nada
- # Examples: ReportPhotoshopFontItems({{'Format','Font'},{'Format','Styles'});
- # Assumptions:
- #========================================================================
- # History:
- # 03/08/96 MDF Created.
- #########################################################################
- task ReportPhotoshopFontItems(pMenuList, pObjectNumber := '')
- begin
- global gFontList, gFontSizeList, gFontStyleList, gScriptResourceBase;
-
- failStr := '';
- selectedItems := ""; # Init selectedItems
-
- if( await_presence([window t:'Type Tool' o:1],60) )
- begin
- ##Check to see if duplicate items in pMenuList
- tempList := {};
- for each fontRec in pMenuList
- begin
- if( not isMember(fontRec, tempList) )
- tempList := Insert(fontRec, Card(tempList)+1, tempList);
- end;
- pMenuList := tempMenuList;
-
- ##What font is selected ?
- fontIndex := 1; # initialize
- fontNotFound := 1; # initialize
- fontTypeRect := {77,12,183,32}; # coords rel to content region of 'Type Tool' dialog
- windBRect := (_match([window t:'Type Tool' o:1])).b;
- fontSearchRect := {windBRect[1]+fontTypeRect[1],windBRect[2]+fontTypeRect[2],
- windBRect[1]+fontTypeRect[3],windBRect[2]+fontTypeRect[4]};
- while(fontNotFound)
- begin
- _match([screen]); # do this BEFORE calling locateString()
- fontPosition := locateString(gFontList[fontIndex],fontSearchRect,
- GetIndString(gScriptResourceBase+1,1),12);
- if(fontPosition) # found the font
- begin
- fontNotFound := 0;
- selectedItems := "{gFontList[fontIndex]}";
- end;
- else
- if( fontIndex = card(gFontList) )
- fontIndex := 1; # re-initialize
- else
- fontIndex := fontIndex + 1;
- end;
-
- ##What size is used?
- sizeIndex := 1; # initialize
- sizeNotFound := 1; # initialize
- sizeBoxRect := {76,35,126,58}; # coords rel to content region of 'Type Tool' dialog
- sizeSearchRect := {windBRect[1]+sizeBoxRect[1],windBRect[2]+sizeBoxRect[2],
- windBRect[1]+sizeBoxRect[3],windBRect[2]+sizeBoxRect[4]};
- while(sizeNotFound)
- begin
- _match([screen]); # do this BEFORE calling locateString()
- sizePosition := locateString(gFontSizeList[sizeIndex],sizeSearchRect,
- GetIndString(gScriptResourceBase+1,1),12);
- if(sizePosition) # found the size
- begin
- sizeNotFound := 0;
- selectedItems := "{selectedItems}-{gFontSizeList[sizeIndex]}";
- end;
- else
- if( sizeIndex = card(gFontSizeList) )
- sizeIndex := 1; # re-initialize
- else
- sizeIndex := sizeIndex + 1;
- end;
-
- ##Gather the selected styles
- for each style in gFontStyleList
- begin
- _move('a',{0,0}); # move cursor out of search area
- switch style
- begin
- case GetIndString(gScriptResourceBase+3,1): # 'Bold'
- styleRect := {28,138,47,155}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,2): # 'Italic'
- styleRect := {28,158,47,172}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,3): # 'Underline'
- styleRect := {28,175,47,191}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,4): # 'Outline'
- styleRect := {140,138,156,155}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,5): # 'Shadow'
- styleRect := {140,158,156,172}; # rel to content rgn
- case GetIndString(gScriptResourceBase+3,6): # 'Anti-Aliased'
- styleRect := {140,175,156,191}; # rel to content rgn
- end;
-
- styleSearchRect := {windBRect[1]+styleRect[1],windBRect[2]+styleRect[2],
- windBRect[1]+styleRect[3],windBRect[2]+styleRect[4]};
- # styleRect converted from local coords
- # to screen coords
-
- _match([screen]); # do this BEFORE calling locateImage()
- styleRect := locateImage(,styleSearchRect,201);
- if(styleRect)
- selectedItems := "{selectedItems}-{style}";
- end;
-
- TCSStart({ 4, global kTCSetFont },"Type SelectedItems String");
-
- if(selectedItems)
- TypeStr(selectedItems); # Type the selected menu items
- else
- TCSFlag := 0; # Fail the TCS
-
- SpecialKey(EnterKey,"Enter Key - closes the 'Type Tools' dialog");
- if( await_absence([window t:"Type Tools" o:1],60) )
- begin
- logStr("Clicking in corner of doc window to complete text entry...");
- SetTool(global MarqueeTool);
- MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2);
- TCSFlag := 1;
- end;
- else
- begin
- TCSFlag := 0;
- failStr := "Could not close the 'Type Tools' dialog by pressing the return key";
- logStr(failStr);
- DialogDismisser('All',[window t:"Type Tools" o:1]);
- end;
- end;
- else
- begin
- TCSFlag := 0;
- failStr := "The 'Type Tool' dialog was not present, couldn't report font item selections";
- logStr(failStr);
- end;
- TCSEnd({ 4, global kTCSetFont }, TCSFlag, failStr, pObjectNumber, selectedItems);
-
- end; # ReportPhotoshopFontItems
-
-
- #########################################################################
- # SetPhotoshopLine(pTheLine, pSelectLine, pObjectNumber)
- #========================================================================
- # Author: MDF
- # Description: This is used when selecting line weights from a palette.
- # This task takes a LineStruct as a parameter. If the LineStruct
- # evaluates to 'Random' a LineStruct will be generated randomly.
- # If the pSelectLine evaluates to true the line will also be selected.
- # Otherwise, the generated LineStruct will be returned without
- # selecting the line weight. Overrides libs so that the 'Brushes'
- # palette is removed. This is done so that this palette does not
- # interfere with drawing in the document window.
- # Parameters: pTheLine - 0 - nothing done return 0
- # - Valid LineStruct
- # - 'Random' - generates a random LineStruct
- # pSelectLine - Boolean flag which indicates whether or not to
- # select the line.
- # pObjectNumber - Integer used to track all elements that make up
- # an object - TCS related.
- # Returns: lineStruct - A valid LineStruct
- # Examples: SetPhotoshopLine('Random', 1, 14);
- # Assumptions: All draw related data structures set up properly.
- #========================================================================
- # History:
- # 03/08/96 MDF Created.
- #########################################################################
- TASK SetPhotoshopLine(pTheLine := 'Random', pSelectLine := 1, pObjectNumber := 0)
- begin
- global gScriptResourceBase;
-
- if( _matchBoolean([menuitem t:"Show Brushes"]) )
- SelectMenuItem("Show Brushes","Palettes","Window");
-
- lineStruct := SetPaletteItem(pTheLine, pSelectLine, "Line",
- global kLinePaletteNum, pObjectNumber);
-
- if( _matchBoolean([menuitem t:"Hide Brushes"]) )
- SelectMenuItem("Hide Brushes","Palettes","Window");
-
- return(lineStruct);
- end; # SetLine()
-
-
- #########################################################################
- # SetPhotoShopColor(pTheColor, pSelectColor, pObjectNumber)
- #========================================================================
- # Author: MDF
- # Description: This is used when selecting colors from a palette. This task
- # takes a ColorStruct as a parameter. If the ColorStruct evaluates
- # to 'Random' a ColorStruct will be generated randomly. If the
- # pSelectColor evaluates to true the color will also be selected.
- # Otherwise, the generated ColorStruct will be returned without
- # selecting the color. Overrides libs because the proper color
- # swatch must be selected first and dialog check must
- # be done in order to set the background color. Also removes
- # 'Picker' palette so that it does not interfere with drawing in
- # the document window. The color palette is assembled here
- # since the name of this window can change depending on the
- # number of times the application has been launched.
- # Parameters: pTheColor - 0 - nothing done return 0
- # - Valid ColorStruct
- # - 'Random' - generates a random ColorStruct
- # pSelectColor - Boolean flag which indicates whether or not to
- # select the Color.
- # pObjectNumber - Integer used to track all elements that make up
- # an object - TCS related.
- # Returns: colStruct - A valid ColorStruct
- # Examples: SetPhotoShopColor('Random', 1, 14);
- # Assumptions: All draw related data structures set up properly.
- #========================================================================
- # History:
- # 03/08/96 MDF Created.
- #########################################################################
- task SetPhotoShopColor(pTheColor := 'Random', pSelectColor := 1,
- pObjectNumber := 0)
- begin
- global gScriptResourceBase, gPaletteList, kPalWind;
-
- if( _matchBoolean([menuitem t:"Show Picker"]) )
- SelectMenuItem("Show Picker","Palettes","Window");
-
- if( _matchBoolean([window t:"Picker"]) )
- colPalTitle := "Picker";
- if( _matchBoolean([window t:"Scratch"]) )
- colPalTitle := "Scratch";
-
- colPalList :=
- {
- { #### Start Palette #4 - Color (both foreground and background)
- {colPalTitle,90,2}, # Specifier, Top margin, left margin
- kPalWind, # Palette type
- {200,18}, # Size {numElemsWide,numElemsTall}
- {1,1} # Offset between tools {h,v}
- } #### End Palette #4 - Color (both foreground and background)
- };
-
- gPaletteList := gPaletteList + colPalList;
-
- logStr("Clicking on the foreground color swatch in the color palette...");
- MoveRelativeToWindow(172,36,[window t:colPalTitle],2);
- if( await_presence([window t:'Color Picker' o:1],60) )
- begin
- logStr("'Color Picker' dialog appeared, dimissing dialog by hitting cancel button...");
- DialogDismisser( 1,[window t:'Color Picker' o:1]);
- end;
-
- colStruct := SetPaletteItem(pTheColor, pSelectColor, "Color",
- global kColorPaletteNum, pObjectNumber);
-
- if( _matchBoolean([menuitem t:"Hide Picker"]) )
- SelectMenuItem("Hide Picker","Palettes","Window");
-
- return(colStruct);
-
- end; # SetPhotoShopColor
-
-
- #########################################################################
- # SetPhotoshopBackgroundColor(pBackgroundColor, pSelectItem, pObjectNumber)
- #========================================================================
- # Author: MDF
- # Description: This is used when selecting Background Colors from a palette.
- # This task takes an element struct, item number, or "Random"
- # as a parameter. If 'Random', an element struct will be
- # generated randomly. If pSelectItem evaluates to true the
- # element struct will also be selected. Overrides libs because
- # the proper color swatch must be selected first and dialog check
- # must be done in order to set the background color. Also removes
- # 'Picker' palette so that it does not interfere with drawing in
- # the document window.
- # Parameters: pBackgroundColor - 0 - nothing done return 0
- # - Valid Item Num
- # - valid element struct
- # - 'Random' - generates a random element struct
- # pSelectItem - Boolean flag which indicates whether or not to
- # select the element.
- # pObjectNumber - Integer used to track all elements that make up
- # an object - TCS related.
- # Returns: BackgroundColorStruct - A valid BackgroundColorStruct
- # Examples: SetPhotoshopBackgroundColor('Random', 1, 14);
- # Assumptions: All draw related data structures set up properly.
- #========================================================================
- # History:
- # 03/08/96 MDF Created.
- #########################################################################
- task SetPhotoshopBackgroundColor(pBackgroundColor := 'Random', pSelectItem := 1,
- pObjectNumber := 0)
- begin
- global gScriptResourceBase, gPaletteList, kPalWind;
-
- if( _matchBoolean([menuitem t:"Show Picker"]) )
- SelectMenuItem("Show Picker","Palettes","Window");
-
- if( _matchBoolean([window t:"Picker"]) )
- colPalTitle := "Picker";
- if( _matchBoolean([window t:"Scratch"]) )
- colPalTitle := "Scratch";
-
- colPalList :=
- {
- { #### Start Palette #4 - Color (both foreground and background)
- {colPalTitle,90,2}, # Specifier, Top margin, left margin
- kPalWind, # Palette type
- {200,18}, # Size {numElemsWide,numElemsTall}
- {1,1} # Offset between tools {h,v}
- } #### End Palette #4 - Color (both foreground and background)
- };
-
- gPaletteList := gPaletteList + colPalList;
-
- logStr("Clicking on the background color swatch in the color palette...");
- MoveRelativeToWindow(190,52,[window t:colPalTitle],2);
- if( await_presence([window t:'Color Picker' o:1],60) )
- begin
- logStr("'Color Picker' dialog appeared, dimissing dialog by hitting cancel button");
- DialogDismisser( 1,[window t:'Color Picker' o:1]);
- end;
-
- backgroundColorStruct := SetPaletteItem(pBackgroundColor, pSelectItem,
- "Background Color",
- global kBackgroundColorPaletteNum,
- pObjectNumber);
-
- if( _matchBoolean([menuitem t:"Hide Picker"]) )
- SelectMenuItem("Hide Picker","Palettes","Window");
-
- return(backgroundColorStruct);
-
- end; # SetPhotoshopBackgroundColor
-
-
- #########################################################################
- # ModifyForRevertHook()
- #========================================================================
- # Author: MDF
- # Description: Modifies the photoshop document so that Revert can be done.
- # Calls Scrapbook to paste a PICT into the document.
- # Parameters: None
- # Returns: Nothing
- # Examples: ModifyForRevertHook();
- # Assumptions: None
- #========================================================================
- # History:
- # MDF 08/24/95 Created
- #########################################################################
- task ModifyForRevertHook()
- begin
- return( Scrapbook(global kScrapPict) );
- end; # ModifyForRevertHook
-
-
- #########################################################################
- # PrintForCloseHook()
- #========================================================================
- # Author: Geraldine O'Sullivan
- # Description: Waits for printing process dialog to clear.
- # Parameters: None
- # Returns: Nothing
- # Examples: PrintForCloseHook()
- # Assumptions: none
- #========================================================================
- # History:
- #
- #########################################################################
- task PrintForCloseHook()
- begin
- if(global gPrintTest)
- begin
- TCSStart({ 1, global kTCSetPrinting },"Select 'Print' Menuitem");
- SelectMenuItem(PrintMI[1], PrintMI[2]); #To select Print
- if( await_presence([button t:'Proceed' w:1],30) )
- begin
- logStr("Clearing the alert dialog...");
- SpecialKey(ReturnKey,"Return Key - selects 'Proceed' button");
- await_absence([button t:'Proceed' w:1],30);
- end;
- wait(2);
- PrintDialogDesc:= _match([window o:1]!,1);
- if (global gPrinterHook)
- call (gPrinterHook);
- SpecialKey(returnKey, 'Return Key'); #To Select the Default-'OK'
- if not (FindWindow(PrintDialogDesc, true))
- TCSEnd({ 1, global kTCSetPrinting },1);
- else
- TCSEnd({ 1, global kTCSetPrinting },0);
- await_presence([window t:GetIndString(global gScriptResourceBase+4,1) o:1],60); # window title is ' Printing'
- await_presence([window t:GetIndString(global gScriptResourceBase+4,1) o:1],60); # window title is ' Printing'
- end;
- end; # PrintForCloseHook
-
-
- #########################################################################
- # FilterTCS()
- #========================================================================
- # Author: MF
- # Description: Applies all of the Filters in the 'Filter' menuitem.
- # Parameters: none
- # Returns: nada
- # Examples: FilterTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/01/96 MDF Created.
- #########################################################################
- task FilterTCS()
- begin
- println;
- println "------- Beginning Filter Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- testCaseList := # menu item list
- {
- {"Blur","Blur","Filter"},
- {"Blur More","Blur","Filter"},
- {"Gaussian Blur…","Blur","Filter"},
- {"Motion Blur…","Blur","Filter"},
- {"Add Noise…","Noise","Filter"},
- {"Despeckle","Noise","Filter"},
- {"Dust & Scratches…","Noise","Filter"},
- {"Median…","Noise","Filter"},
- {"Facet","Pixelate","Filter"},
- {"Fragment","Pixelate","Filter"},
- {"Mosaic…","Pixelate","Filter"},
- {"Sharpen","Sharpen","Filter"},
- {"Sharpen Edges","Sharpen","Filter"},
- {"Sharpen More","Sharpen","Filter"},
- {"Unsharp Mask…","Sharpen","Filter"},
- {"Diffuse…","Stylize","Filter"},
- {"Emboss…","Stylize","Filter"},
- {"Find Edges","Stylize","Filter"},
- {"Trace Contour…","Stylize","Filter"},
- {"Custom…","Other","Filter"},
- {"High Pass…","Other","Filter"},
- {"Maximum…","Other","Filter"},
- {"Minimum…","Other","Filter"},
- {"Offset…","Other","Filter"}
- };
-
- for each filterTest in RandomList(testCaseList)
- begin
- TCSStart({1,"ApplyFilter"},"Apply '{filterTest[1]}' Filter");
-
- if( card(filterTest) < 3 ) # non-hierarchical menu
- returnVal := SelectMenuItem(filterTest[1],filterTest[2]);
- else # hierarchical menu
- returnVal := SelectMenuItem(filterTest[1],filterTest[2],filterTest[3]);
-
- if(returnVal) # selected menuitem successfully
- begin
- if( IsSubString("…",filterTest[1]) ) # expect a dialog
- begin
- windTitle := StringUntilChar(filterTest[1],"…");
- if( await_presence([window t:windTitle o:1],60) )
- begin
- SpecialKey(ReturnKey,"ReturnKey - 'OK' button");
- if( await_absence([window t:windTitle o:1],60) )
- begin
- failStr := "";
- TCSReturn := 1;
- end;
- else
- begin
- TCSReturn := 0;
- failStr := "Could not apply filter by selecting the 'OK' button in the {windTitle} dialog";
- DialogDismisser('All',[window t:windTitle]);
- end;
- end;
- else
- begin
- TCSReturn := 0;
- failStr := "Filter window for {windTitle} did not appear";
- end;
- end;
- else
- begin
- failStr := "";
- TCSReturn := 1;
- end;
- end;
- else # could not select menu item
- begin
- theMenuItem := _match([menuitem t:filterTest[1] m:filterTest[2]]);
- TCSReturn := 0;
- if(theMenuItem)
- if(not theMenuItem.e)
- failStr := "MenuItem is disabled so it couldn't be selected";
- else
- failStr := "MenuItem is not present, so it couldn't be selected";
- end;
-
- TCSEnd({1,"ApplyFilter"},TCSReturn,failStr);
- end;
- println "------- Completed Filter Tests --------";
- println;
- end; # FilterTCS
-
-
- #########################################################################
- # SaveFormatTCS()
- #========================================================================
- # Author: MF
- # Description: Saves the PhotoShop document in 9 different formats.
- # Parameters: none
- # Returns: nada
- # Examples: SaveFormatTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/04/96 MDF Created.
- #########################################################################
- task SaveFormatTCS()
- begin
- println;
- println "------- Beginning SaveFormat Tests --------";
-
- global gFileName;
- returnVal := 0;
-
- testCaseList := # popup names
- {
- "PhotoShop 2.0",
- "EPS",
- "JPEG",
- "PICT File",
- "PICT Resource",
- "RAW",
- "Scitex CT",
- "TIFF",
- "PhotoShop 3.0"
- };
-
- for each formatTest in testCaseList
- begin
- TCSStart({ 1, global kTCSetSFSave },"SaveAs '{formatTest}' format"); # Start TCS
- thisReturn := SelectMenuItem(7,2); # 'Save As','File'
- TCSEnd({ 1, global kTCSetSFSave },thisReturn); # Select the MenuItem
-
- isPresent := IsStandardFile();
- if not(isPresent)
- begin
- wait(8);
- isPresent := IsStandardFile();
- end;
-
- ## Continue only if Standard File is present
- if (isPresent)
- begin
- SFPutDesc:= _match ([window o:1],1); # Save off the descriptor
-
- LogStr("############## Standard File - Save ##############");
-
- if(formatTest = "PhotoShop 3.0")
- TypeStr(gFileName);
- else
- TypeStr("@!@-{formatTest}"); # Type the name of the Document
-
- SelectPopUpMenuItem(formatTest, "Format");
- SpecialKey(ReturnKey, 'Return Key'); # Accept the SF dialog
-
- if( await_presence([button t:'Replace' w:1],30) )
- begin
- SelectButton('Replace');
- returnval:= 2;
- end;
-
- if( await_presence([window o:1 s:movablemodal],60) )
- begin
- logStr("Accepting default format options...");
- SpecialKey(ReturnKey, 'Return Key');
- await_absence([window o:1 s:movablemodal]);
- end;
-
- if not FindWindow(SFPutDesc, true) # if we can't find SFPut Dialog, indicates saved document for 1st time
- begin
- if not (returnval) # if not already reset from replace exist
- begin
- returnVal := 1; # set to success - no replace exist done
- TCSStart({ 2, global kTCSetSFSave },"Save a new file");
- TCSEnd({ 2, global kTCSetSFSave },1,,,"@!@-{formatTest}");
- end; # if not returnval
- end;
- else
- logStr("Unable to dismiss the SFPut dialog");
- end;
- end;
- println "------- Completed SaveFormat Tests --------";
- println;
- end; # SaveFormatTCS
-
-
- #########################################################################
- # MoveTCS()
- #========================================================================
- # Author: MF
- # Description: Moves a region of a document that has been selected by the
- # Marquee or Lasso tools to a random location within the
- # document window.
- # Parameters: none
- # Returns: nada
- # Examples: MoveTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/04/96 MDF Created.
- #########################################################################
- task MoveTCS()
- begin
- println;
- println "------- Beginning Move Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- objectStruct := Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
- pointList := objectStruct[2];
- objectRect := {
- pointList[1][1],pointList[1][2],
- pointList[2][1],pointList[2][2]
- };
-
- TCSStart({1,"MoveObject"},"Move region cut-out");
-
- windDesc := FindWindow([window t:/≈RGB≈/]);
- if(windDesc)
- begin
- if (card(objectRect) = 4) # if objectRect describes a rectangle
- begin
- objectCenter := CenterPointOfRect(objectRect); # from SPEC: Geometry.Lib
- logStr("Moving cursor to center of object...");
- MoveRelativeToWindow(objectCenter[1],objectCenter[2],[window t:/≈RGB≈/]); # move to center
- end;
-
- logStr("Moving the object to a random location...");
- MoveRelativeToWindow(,,[window t:/≈RGB≈/],1); # move the object
- TCSReturn := 1;
- end;
- else
- begin
- failStr := "Could not find specified window";
- TCSReturn := 0;
- end;
-
- TCSEnd({1,"MoveObject"},TCSReturn,failStr);
-
- logStr("Clicking in corner of doc window to disable marquee");
- SetTool(global MarqueeTool);
- MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2);
-
- println "------- Completed Move Tests --------";
- println;
-
- end; # MoveTCS
-
-
- #########################################################################
- # EffectsTCS()
- #========================================================================
- # Author: MF
- # Description: Applies effects to a selected region of the document region.
- # Returns: nada
- # Examples: EffectsTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/04/96 MDF Created.
- #########################################################################
- task EffectsTCS()
- begin
- println;
- println "------- Beginning Effect Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- testCaseList := # menu item list
- {
- {"Scale","Effects","Image"},
- {"Skew","Effects","Image"},
- {"Perspective","Effects","Image"},
- {"Distort","Effects","Image"}
- };
-
- for each effectTest in RandomList(testCaseList)
- begin
- objectStruct := Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
- pointList := objectStruct[2];
- objectRect := {
- pointList[1][1],pointList[1][2],
- pointList[2][1],pointList[2][2]
- };
-
- TCSStart({1,"ApplyEffect"},"Apply '{effectTest[1]}' effect");
-
- returnVal := SelectMenuItem(effectTest[1],"Effects","Image");
-
- if(returnVal) # selected menuitem successfully
- begin
- windDesc := FindWindow([window t:/≈RGB≈/]);
- if(windDesc)
- begin
- MoveRelativeToWindow(objectRect[1],objectRect[2],[window t:/≈RGB≈/]); # move to the object handle point
- MoveRelativeToWindow(,,[window t:/≈RGB≈/],1); # move the handle
- SpecialKey(EnterKey,"Enter-Key disables object");
- failStr := "";
- TCSReturn := 1; # success
- end;
- else
- failStr := "Could not find specified window";
- end;
- else # could not select menuitem
- begin
- theMenuItem := _match([menuitem t:effectTest[1] m:[menuitem t:"Effects" m:[menu t:"Image"]]]);
- TCSReturn := 0;
- if(theMenuItem)
- if(not theMenuItem.e)
- failStr := "MenuItem is disabled, so it couldn't be selected";
- else
- failStr := "MenuItem is not present, so it couldn't be selected";
- end;
-
- TCSEnd({1,"ApplyEffect"},TCSReturn,failStr);
- end;
- println "------- Completed Effects Tests --------";
- println;
-
- end; # EffectsTCS
-
-
- #########################################################################
- # RotateTCS()
- #========================================================================
- # Author: MF
- # Description: Randomly rotates selected regions of the document.
- # Parameters: none
- # Returns: nada
- # Examples: RotateTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/05/96 MDF Created.
- #########################################################################
- task RotateTCS()
- begin
- println;
- println "------- Beginning Rotation Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- testCaseList := # menu item list
- {
- {"180°","Rotate","Image"},
- {"90° CW","Rotate","Image"},
- {"90° CCW","Rotate","Image"},
- {"Arbitrary…","Rotate","Image"}
- };
-
- for each rotationTest in RandomList(testCaseList)
- begin
- TCSStart({1,"ApplyRotation"},"Apply '{rotationtest[1]}' rotation");
-
- returnVal := SelectMenuItem(rotationTest[1],"Rotate","Image");
-
- if(returnVal) # selected menuitem sucessfully
- begin
- if( rotationTest[1] = "Arbitrary…" )
- begin
- if( await_presence([window t:/Arbitrary≈/ o:1],60) )
- begin
- angle := random(0,359); # generate a random angle
- TypeStr(numToStr(angle,10)); # type angle into the dialog
- SpecialKey(ReturnKey,"ReturnKey - to close the 'Arbitrary Rotate' dialog"); # close dialog
- if( await_absence([window t:/Arbitrary≈/ o:1],60) )
- begin
- failStr := "";
- TCSReturn := 1;
- end;
- else
- begin
- TCSReturn := 0;
- failStr := "Could not do arbitrary rotation by selecting the 'OK' button";
- DialogDismisser('All',[window t:/Arbitrary≈/ o:1]);
- end;
- end;
- else
- begin
- TCSReturn := 0;
- failStr := "The window 'Arbitary Rotate' did not appear";
- end;
- end;
- else
- begin
- failStr := "";
- TCSReturn := 1;
- end;
- end;
- else
- begin
- theMenuItem := _match([menuitem t:rotationTest[1] m:[menuitem t:"Rotate" m:[menu t:"Image"]]]);
- TCSReturn := 0;
- if(theMenuItem)
- if(not theMenuItem.e)
- failStr := "MenuItem is disabled, so it couldn't be selected";
- else
- failStr := "MenuItem is not present, so it couldn't be selected";
- end;
- TCSEnd({1,"ApplyRotation"},TCSReturn,failStr);
- end;
- println "------- Completed Rotation Tests --------";
- println;
-
- end; # RotateTCS
-
-
- #########################################################################
- # FlipTCS()
- #========================================================================
- # Author: MF
- # Description: Randomly flips selected regions of the document.
- # Parameters: none
- # Returns: nada
- # Examples: FlipTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/04/96 MDF Created.
- #########################################################################
- task FlipTCS()
- begin
- println;
- println "------- Beginning Flip Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- testCaseList := # menu item list
- {
- {"Horizontal","Flip","Image"},
- {"Vertical","Flip","Image"}
- };
-
- for each flipTest in RandomList(testCaseList)
- begin
- TCSStart({1,"ApplyFlip"},"Apply '{flipTest[1]}' Flip");
-
- returnVal := SelectMenuItem(flipTest[1],"Flip","Image");
-
- if(returnVal) # selected menuitem sucessfully
- begin
- failStr := "";
- TCSReturn := 1;
- end;
- else
- begin
- theMenuItem := _match([menuitem t:flipTest[1] m:[menuitem t:"Flip" m:[menu t:"Image"]]]);
- TCSREturn := 0;
- if(theMenuItem)
- if(not theMenuItem.e)
- failStr := "MenuItem is disabled, so it couldn't be selected";
- else
- failStr := "MenuItem is not present, so it couldn't be selected";
- end;
- TCSEnd({1,"ApplyFlip"},TCSReturn,failStr);
- end;
- println "------- Completed Flip Tests --------";
- println;
-
- end; # FlipTCS
-
-
- #########################################################################
- # ViewsTCS()
- #========================================================================
- # Author: MF
- # Description: Changes the views of the document window by zooming in/out and
- # showing/hiding the rulers.
- # Parameters: none
- # Returns: nada
- # Examples: ViewsTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/04/96 MDF Created.
- #########################################################################
- task ViewsTCS()
- begin
- println;
- println "------- Beginning Views Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
- pCommentStr := "";
-
- testCaseList := # menu item list
- {
- {"Zoom In","Window"},
- {"Zoom Out","Window"},
- {"Zoom Factor…","Window"},
- {"Show Ruler","Window"},
- {"Hide Ruler","Window"}
- };
-
- await_presence([window t:/≈RGB≈/ o:2],60); # waits for document window with this desc to appear
-
- for each viewTest in testCaseList # don't do this randomly
- begin
- TCSStart({1,"ChangeViews"},"View: '{viewTest[1]}'");
-
- returnVal := SelectMenuItem(viewTest[1],"Window");
-
- if(returnVal) # selected menuitem sucessfully
- begin
- if( viewTest[1] = "Zoom Factor…" )
- begin
- if( await_presence([window t:/Zoom≈/ o:1],60) )
- begin
- zoomVal := random(1,10); # generate random zoom factor
- pCommentStr := "Magnify {zoomVal}x";
- TypeStr(numToStr(zoomVal,10)); # type zoom factor into the dialog
- SpecialKey(ReturnKey,"ReturnKey - to close the 'Zoom Factor' dialog"); # close dialog
- if( await_absence([window t:/Zoom≈/ o:1],60) )
- begin
- failStr := "";
- TCSReturn := 1;
- end;
- else
- begin
- TCSReturn := 0;
- failStr := "Could not do arbitrary zoom by selecting the 'OK' button";
- DialogDismisser('All',[window t:/Zoom≈/ o:1],60);
- end;
- end;
- else
- begin
- TCSReturn := 0;
- failStr := "The window 'Zoom Factor' did not appear";
- end;
- end;
- else
- begin
- failStr := "";
- TCSReturn := 1;
- end;
- end;
- else
- begin
- theMenuItem := _match([menuitem t:viewTest[1] m:'Window']);
- TCSReturn := 0;
- if(theMenuItem)
- if(not theMenuItem.e)
- failStr := "MenuItem is disabled, so it couldn't be selected";
- else
- failStr := "MenuItem is not present, so it couldn't be selected";
- end;
- TCSEnd({1,"ChangeViews"},TCSReturn,failStr,,,pCommentStr);
- end;
- println "------- Completed Views Tests --------";
- println;
-
- end; # ViewsTCS
-
-
- #########################################################################
- # ColorPaletteTCS()
- #========================================================================
- # Author: MF
- # Description: Rotates selected regions of the document.
- # Parameters: none
- # Returns: nada
- # Examples: ColorPaletteTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/07/96 MDF Created.
- #########################################################################
- task ColorPaletteTCS()
- begin
- println;
- println "------- Beginning Color Palette Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- testCaseList := # menu item list
- {
- {"Grayscale","Mode"},
- {"CMYK Color","Mode"},
- {"Lab Color","Mode"},
- {"Multichannel","Mode"},
- {"RGB Color","Mode"}
- };
-
- for each colorMode in testCaseList
- begin
- TCSStart({1,"ColorMode"},"Change Color Mode to '{colorMode[1]}'");
-
- returnVal := SelectMenuItem(colorMode[1],"Mode");
-
- if(returnVal) # selected menuitem sucessfully
- begin
- if( colorMode[1] = "Grayscale" )
- begin
- if( await_presence([staticText t:'Discard color information?' w:1],60) )
- begin
- SpecialKey(ReturnKey,"ReturnKey - to close alert dialog box");
- if( await_absence([staticText t:'Discard color information?' w:1],60) )
- begin
- failStr := "";
- TCSReturn := 1;
- end;
- else
- begin
- TCSReturn := 0;
- failStr := "Could dismiss 'Discard color information' alert by selecting the 'OK' button";
- DialogDismisser('All',[staticText t:'Discard color information?' w:1]);
- end;
- end;
- end;
- else
- begin
- failStr := "";
- TCSReturn := 1;
- end;
- end;
- else
- begin
- theMenuItem := _match([menuitem t:colorMode[1] m:"Mode"]);
- TCSREturn := 0;
- if(theMenuItem)
- if(not theMenuItem.e)
- failStr := "MenuItem is disabled, so it couldn't be selected";
- else
- failStr := "MenuItem is not present, so it couldn't be selected";
- end;
- TCSEnd({1,"ColorMode"},TCSReturn,failStr);
- end;
-
- println "------- Completed Color Palette Tests --------";
- println;
-
- end; # ColorPaletteTCS
-
-
- #########################################################################
- # EditMenuTCS()
- #========================================================================
- # Author: MF
- # Description: Selects menu items from the Edit menu in the order called.
- # Parameters: none
- # Returns: nada
- # Examples: EditMenuTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/07/96 MDF Created.
- #########################################################################
- task EditMenuTCS()
- begin
- CutTCS();
- PasteTCS();
- CopyTCS();
- PasteTCS();
- ClearTCS();
- CropTCS();
- UndoTCS();
- end; # EditMenuTCS
-
-
- #########################################################################
- # UndoTCS()
- #========================================================================
- # Author: MF
- # Description: Selects the 'Undo' menu item from the Edit menu if the menu
- # item is enabled.
- # Parameters: none
- # Returns: nada
- # Examples: UndoTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/07/96 MDF Created.
- #########################################################################
- task UndoTCS()
- begin
- println;
- println "------- Beginning Undo Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- theMenuItem := _match([menuitem t:/Undo≈/ m:Edit]);
- if( theMenuItem.e ) # is it enabled to select?
- begin
- TCSStart({1,"EditMenuTest"},"Select 'Undo' menuitem");
-
- returnVal := SelectMenuItem(/Undo≈/,"Edit");
- if(returnVal)
- TCSReturn := 1;
- else
- failStr := "MenuItem 'Undo' is not present, so it couldn't be selected";
-
- TCSEnd({1,"EditMenuTest"},TCSReturn,failStr);
- end;
- else # don't fail testcase if not enabled
- logStr("Not executing 'Undo' since this menu item not enabled");
-
- println "------- Completed Undo Tests --------";
- println;
-
- end; # UndoTCS
-
-
- #########################################################################
- # CutTCS()
- #========================================================================
- # Author: MF
- # Description: Selects the 'Cut' menu item from the Edit menu if the menu
- # item is enabled.
- # Parameters: none
- # Returns: nada
- # Examples: CutTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/07/96 MDF Created.
- #########################################################################
- task CutTCS()
- begin
- println;
- println "------- Beginning Cut Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
-
- theMenuItem := _match([menuitem t:"Cut" m:Edit]);
- if( theMenuItem.e ) # is it enabled to select?
- begin
- TCSStart({2,"EditMenuTest"},"Select 'Cut' menuitem");
-
- returnVal := SelectMenuItem("Cut","Edit");
- if(returnVal)
- TCSReturn := 1;
- else
- failStr := "MenuItem 'Cut' is not present, so it couldn't be selected";
-
- TCSEnd({2,"EditMenuTest"},TCSReturn,failStr);
- end;
- else # don't fail testcase if not enabled
- logStr("Not executing 'Cut' since this menu item not enabled");
-
- println "------- Completed Cut Tests --------";
- println;
-
- end; # CutTCS
-
-
- #########################################################################
- # CopyTCS()
- #========================================================================
- # Author: MF
- # Description: Selects the 'Copy' menu item from the Edit menu if the menu
- # item is enabled.
- # Parameters: none
- # Returns: nada
- # Examples: CopyTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/07/96 MDF Created.
- #########################################################################
- task CopyTCS()
- begin
- println;
- println "------- Beginning Copy Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
-
- theMenuItem := _match([menuitem t:"Copy" m:Edit]);
- if( theMenuItem.e ) # is it enabled to select?
- begin
- TCSStart({3,"EditMenuTest"},"Select 'Copy' menuitem");
-
- returnVal := SelectMenuItem("Copy","Edit");
- if(returnVal)
- TCSReturn := 1;
- else
- failStr := "MenuItem 'Copy' is not present, so it couldn't be selected";
-
- TCSEnd({3,"EditMenuTest"},TCSReturn,failStr);
- end;
- else # don't fail testcase if not enabled
- logStr("Not executing 'Copy' since this menu item not enabled");
-
- logStr("Clicking in corner of doc window to disable marquee");
- SetTool(global MarqueeTool);
- MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2);
-
- println "------- Completed Copy Tests --------";
- println;
-
- end; # CopyTCS
-
-
- #########################################################################
- # PasteTCS()
- #========================================================================
- # Author: MF
- # Description: Selects the 'Paste' menu item from the Edit menu if the menu
- # item is enabled.
- # Parameters: none
- # Returns: nada
- # Examples: PasteTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/07/96 MDF Created.
- #########################################################################
- task PasteTCS()
- begin
- println;
- println "------- Beginning Paste Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- theMenuItem := _match([menuitem t:"Paste" m:Edit]);
- if( theMenuItem.e ) # is it enabled to select?
- begin
- TCSStart({4,"EditMenuTest"},"Select 'Paste' menuitem");
-
- returnVal := SelectMenuItem("Paste","Edit");
- if(returnVal)
- TCSReturn := 1;
- else
- failStr := "MenuItem 'Paste' is not present, so it couldn't be selected";
-
- TCSEnd({4,"EditMenuTest"},TCSReturn,failStr);
- end;
- else # don't fail testcase if not enabled
- logStr("Not executing 'Paste' since this menu item not enabled");
-
- println "------- Completed Paste Tests --------";
- println;
-
- end; # PasteTCS
-
-
- #########################################################################
- # ClearTCS()
- #========================================================================
- # Author: MF
- # Description: Selects the 'Clear' menu item from the Edit menu if the menu
- # item is enabled.
- # Parameters: none
- # Returns: nada
- # Examples: ClearTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/07/96 MDF Created.
- #########################################################################
- task ClearTCS()
- begin
- println;
- println "------- Beginning Clear Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
-
- theMenuItem := _match([menuitem t:"Clear" m:Edit]);
- if( theMenuItem.e ) # is it enabled to select?
- begin
- TCSStart({5,"EditMenuTest"},"Select 'Clear' menuitem");
-
- returnVal := SelectMenuItem("Clear","Edit");
- if(returnVal)
- TCSReturn := 1;
- else
- failStr := "MenuItem 'Clear' is not present, so it couldn't be selected";
-
- TCSEnd({5,"EditMenuTest"},TCSReturn,failStr);
- end;
- else # don't fail testcase if not enabled
- logStr("Not executing 'Clear' since this menu item not enabled");
-
- logStr("Clicking in corner of doc window to disable marquee");
- SetTool(global MarqueeTool);
- MoveRelativeToWindow(5,5,[window t:/≈RGB≈/],2);
-
- println "------- Completed Clear Tests --------";
- println;
-
- end; # ClearTCS
-
-
- #########################################################################
- # CropTCS()
- #========================================================================
- # Author: MF
- # Description: Selects the 'Crop' menu item from the Edit menu if the menu
- # item is enabled.
- # Parameters: none
- # Returns: nada
- # Examples: CropTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/07/96 MDF Created.
- #########################################################################
- task CropTCS()
- begin
- println;
- println "------- Beginning Crop Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- Draw(global MarqueeTool,,,,,[window t:/≈RGB≈/]);
-
- theMenuItem := _match([menuitem t:"Crop" m:Edit]);
- if( theMenuItem.e ) # is it enabled to select?
- begin
- TCSStart({6,"EditMenuTest"},"Select 'Crop' menuitem");
-
- returnVal := SelectMenuItem("Crop","Edit");
- if(returnVal)
- TCSReturn := 1;
- else
- failStr := "MenuItem 'Crop' is not present, so it couldn't be selected";
-
- TCSEnd({6,"EditMenuTest"},TCSReturn,failStr);
- end;
- else # don't fail testcase if not enabled
- logStr("Not executing 'Crop' since this menu item not enabled");
-
- println "------- Completed Crop Tests --------";
- println;
-
- end; # CropTCS
-
-
- #########################################################################
- # PublishTCS()
- #========================================================================
- # Author: MF
- # Description: Publishes the test document.
- # Parameters: none
- # Returns: nada
- # Examples: PublishTCS();
- # Assumptions: none
- #========================================================================
- # History:
- # 03/07/96 MDF Created.
- #########################################################################
- task PublishTCS()
- begin
- println;
- println "------- Beginning Publish Tests --------";
-
- failStr := "";
- returnVal := 0;
- TCSReturn := 0;
-
- TCSStart({1,"PublishDocument"},"Publish edition");
-
- returnVal := SelectMenuItem("Create Publisher…","Edit");
-
- if(returnVal)
- begin
- if(await_presence([staticText t:'Name of new edition:' w:1],60) )
- begin
- editionFileName := GetNewFileName("PhotoShop Edition",1);
- TypeStr(editionFileName);
- SelectButton("Publish");
- if( await_absence([staticText t:'Name of new edition:' w:1],60) )
- TCSReturn := 1;
- else
- begin
- TCSReturn := 0;
- failStr := "Could not clear the Publish dialog";
- DialogDismisser('All',[staticText t:'Name of new edition:' w:1]);
- end;
- end;
- else
- begin
- theMenuItem := _match([menuitem t:"Create Publisher…" m:"Edit"]);
- TCSReturn := 0;
- if(theMenuItem)
- if(not theMenuItem.e)
- failStr := "menuItem is disabled, so it couldn't be selected";
- else
- failStr := "MenuItem is not present, so it couldn't be selected";
- end;
- TCSEnd({1,"PublishDocument"},TCSReturn,failStr);
- end;
- println "------- Completed Publish Tests --------";
- println;
- end; # PublishTCS
-
-
- #########################################################################
- # ScreenModeTCS()
- #========================================================================
- # Author: MF
- # Description: Functional Test: Cycle through screen modes.
- # Parameters: None
- # Returns: Nothing
- # Examples: ScreenModeTCS()
- # Assumptions: none
- #========================================================================
- # History:
- # 03/08/96 MDF Created.
- #########################################################################
- task ScreenModeTCS()
- begin
- println;
- println "------- Beginning Screen Mode Tests --------";
- Draw(global FullScrnNoMBarTool);
- Draw(global FullScrnMBarTool);
- Draw(global StndWindowsTool);
- println "------- Completed Screen Mode Tests --------";
- println;
- end; # ScreenModeTCS
-
-
- ################################################################################
- #################### Main script ####################
- ################################################################################
- script PhotoShop ( testLevel := 1,
- _______________________ := "_________________________",
- filterTests_flag := 0,
- saveFormatTests_flag := 0,
- moveTests_flag := 0,
- effectsTests_flag := 0,
- rotateTests_flag := 0,
- flipTests_flag := 0,
- viewsTests_flag := 0,
- colorPaletteTests_flag := 0,
- editMenuTests_flag := 0,
- publishTests_flag := 0,
- screenModeTests_flag := 0,
- ______________________ := "_________________________",
- globalDefinitions := {{'gPrintTest',0}},
- pAppLanguage := '',
- pScriptSystem := {} )
- begin
- InitGlobals( testLevel, globalDefinitions ); # initialize general globals
- InitDraw();
- InitFonts();
- InitINTLGlobals( pAppLanguage, pScriptSystem, {'US'} );
- global gApptitle := GetIndString(global gScriptResourceBase,2); # US Title is "Adobe Photoshop PPC"
- global gAppVersion := GetIndString(global gScriptResourceBase,3); # US version is '3.0.1@'
- global glaunchreqs := {'PowerPCArch'}; # Run script only on PowerPC based machine
- SuiteStart('Adobe Photoshop PPC 3.0.1.vu'); # begin a new test suite
- if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to app
- begin
- InitAppGlobals(); # init app specific globals
- global gFileName := "@!@-{gAppTitle}"; # This is used in SaveAs when saving files
- (*
- *)
- quicklookTaskList := { task DoDraw, task DoText, task DoWindow};
-
- functionalTaskList :=
- {
- {task FilterTCS,filterTests_flag},
- {task SaveFormatTCS,saveFormatTests_flag},
- {task MoveTCS,moveTests_flag},
- {task EffectsTCS,effectsTests_flag},
- {task RotateTCS,rotateTests_flag},
- {task FlipTCS,flipTests_flag},
- {task ViewsTCS,viewsTests_flag},
- {task ColorPaletteTCS,colorPaletteTests_flag},
- {task EditMenuTCS,editMenuTests_flag},
- {task PublishTCS,publishTests_flag},
- {task ScreenModeTCS,screenModeTests_flag}
- };
-
- DoSetUpApp(0,-1,{1,2},1,1,1,{7,2},{2,2}); # must start with this
- TestTaskDispatcher(quicklookTaskList,functionalTaskList);
- DoCloseApp({{9,2},{7,2}},0,{16,2},0,{21,2}); # must end with this
- end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
- SuiteEnd();
- end; # script PhotoShop